package com.blindBox.front.config.webConfig;

import com.blindBox.front.handler.hanlderIntercept.TokenHanlderIntercept;
import com.blindBox.front.parse.PathParse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfig implements WebMvcConfigurer
{
    @Autowired
    private PathParse pathParse;
//    @Override
//    public void addInterceptors(InterceptorRegistry registry)
//    {
//    registry.addInterceptor(new TokenHanlderIntercept())
//           //拦截所有以token_开头的请求
//             .addPathPatterns("/token/**");
//    }

    //静态资源路径映射
    public void addResourceHandlers(ResourceHandlerRegistry registry)
    {
        registry.addResourceHandler("/selfImgs/**").addResourceLocations("file:"+pathParse.get_paper_selfImgs_file_path());
    }
}
